package com.boot.security.server.dao.product;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.product.TswSysOperationSource;

@Mapper
public interface TswSysOperationSourceDao {

    @Select("select * from tsw_sys_operation_source t where t.id = #{id}")
    TswSysOperationSource getById(Long id);

    @Delete("delete from tsw_sys_operation_source where id = #{id}")
    int delete(Long id);

    int update(TswSysOperationSource tswSysOperationSource);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into tsw_sys_operation_source(tsw_sys_user_id, operation_type, mall_type, mall_id, operation_source, operation_time, operation_ip, operation_note, operation_remark) values(#{sysUserId}, #{operationType}, #{mallType}, #{mallId}, #{operationSource}, #{operationTime}, #{operationIp}, #{operationNote}, #{operationRemark})")
    int save(TswSysOperationSource tswSysOperationSource);
    
    int count(@Param("params") Map<String, Object> params);

    List<TswSysOperationSource> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
